{% extends "GairalAdminBundle::layout.html.twig" %}

{% block bodyAdmin %}
<section id="experienceAdmin" class="content">
    <div class="row-fluid">
        <table class="table table-striped table-condensed">
            <caption>
                <h4>Experience</h4>
            </caption>
            <thead>
                <tr>
                    <th>Image</th>
                    <th>Name</th>
                    <th>Job title</th>
                    <th>Skills</th>
                    <th>Actions</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td colspan="5">
                        <div class="btn-toolbar text-center">
                            <a href="{{ path('AdminExperienceAdd')}}" class="btn btn-large btn-primary">
                                Add new Experience
                                <i class="icon-white icon-plus"></i>
                            </a>
                        </div>
                    </td>
                </tr>
    {% for experience in listExperience %}
                <tr>
                    <td>
        {% if experience.image %}
                            <img src="{{ asset(experience.image.webPath) }}" alt="education->name"/>
        {% endif %}
                        </td>
                        <td>{{ experience.name }}</td>
                        <td>{{ experience.jobTitle }}</td>
                        <td>
                    {% if experience.skills|length > 0 %}
                                <div class="btn-group">
                                    <a class="btn  btn-info dropdown-toggle" data-toggle="dropdown" href="#">
                                        Skills
                                        <span class="caret"></span>
                                    </a>
                                    <ul class="dropdown-menu">
                    {% for skill in experience.skills %}
                                            <li><a tabindex="-1" href="#">{{ skill.name }}</a></li>
                    {% endfor %}
                                            </ul>
                                        </div>
                    {% endif %}
                                    </td>
                                    <td>
                                        <div class="btn-toolbar">
                                            <div class="btn-group">
                                                <a href="{{ path('AdminExperienceModify', {'id': experience.id})}}" class="btn btn-small btn-inverse">
                                                    Edit
                                                    <i class="icon-white icon-edit"></i>
                                                </a>
                                    {% if experience.displayOrder != maxOrder %}
                                                <a href="{{ path('AdminExperienceUp', {'id': experience.id})}}" class="btn btn-small">
                                                    <i class="icon-arrow-down"></i>
                                                </a>
                                    {% endif %}
                                    {% if experience.displayOrder > 0 %}
                                                <a href="{{ path('AdminExperienceDown', {'id': experience.id})}}" class="btn btn-small">
                                                    <i class="icon-arrow-up"></i>
                                                </a>
                                    {% endif %}
                                            </div>
                                            <a href="#remove_{{experience.id}}" data-toggle="modal" class="btn btn-small btn-danger">
                                                Remove
                                                <i class="icon-white icon-trash"></i>
                                            </a>
                                        </div>

                                        <div class="modal hide" id="remove_{{experience.id}}">
                                            <div class="modal-header"> <a class="close" data-dismiss="modal">×</a>
                                                <h3>Remove Experience</h3>
                                            </div>
                                            <div class="modal-body alert">
                                                <p>
                                                    Are you sure to want to remove the Experience: "{{ experience.name }}" ?
                                                </p>
                                            </div>
                                            <div class="modal-footer">
                                                <a href="{{ path('AdminExperience') }}" class="btn btn-info" data-dismiss="modal">
                                                    Cancel
                                                </a>
                                                <a href="{{ path('AdminExperienceRemove', {'id': experience.id})}}" class="btn btn-danger">
                                                    Remove
                                                    <i class="icon-white icon-trash"></i>
                                                </a>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
    {% else %}
                                no experience
    {% endfor %}
                            </tbody>
                        </table>
                    </div>
                </section>
{% endblock %}